package com.laicunba.service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.laicunba.pojo.WithdrawDO;
import com.laicunba.service.WithdrawService.CPBDoWithdrawParam;
import com.laicunba.service.WithdrawService.DoWithdrawParam;

public interface WithdrawService extends BaseService {
	class DoWithdrawParam {
		private String widthdrawId;

		public void setWidthdrawId(String widthdrawId) {
			this.widthdrawId = widthdrawId;
		}

		public String getWidthdrawId() {
			return widthdrawId;
		}
	}

	class CPBDoWithdrawParam {
		private String financingTargetBidId;
		private String summary;

		public String getFinancingTargetBidId() {
			return financingTargetBidId;
		}

		public String getSummary() {
			return summary;
		}

		public void setFinancingTargetBidId(String financingTargetBidId) {
			this.financingTargetBidId = financingTargetBidId;
		}

		public void setSummary(String summary) {
			this.summary = summary;
		}

	}

	class SCBWithdrawParam {
		private String userId;
		private BigDecimal withdrawAmount;
		private boolean isTry = true;
		private String bankCode;// 银行代码
		private String bankName; // 银行名字
		private String bankCardNo; // 银行卡
		private String holder; // 持卡人
		private String pid; // 身份证
		private String mark = "";

		public void setMark(String mark) {
			this.mark = mark;
		}

		public String getMark() {
			return mark;
		}

		public String getBankCode() {
			return bankCode;
		}

		public String getBankName() {
			return bankName;
		}

		public String getBankCardNo() {
			return bankCardNo;
		}

		public String getHolder() {
			return holder;
		}

		public String getPid() {
			return pid;
		}

		public void setBankCode(String bankCode) {
			this.bankCode = bankCode;
		}

		public void setBankName(String bankName) {
			this.bankName = bankName;
		}

		public void setBankCardNo(String bankCardNo) {
			this.bankCardNo = bankCardNo;
		}

		public void setHolder(String holder) {
			this.holder = holder;
		}

		public void setPid(String pid) {
			this.pid = pid;
		}

		public void setTry(boolean isTry) {
			this.isTry = isTry;
		}

		public boolean isTry() {
			return isTry;
		}

		public String getUserId() {
			return userId;
		}

		public BigDecimal getWithdrawAmount() {
			return withdrawAmount;
		}

		public void setUserId(String userId) {
			this.userId = userId;
		}

		public void setWithdrawAmount(BigDecimal withdrawAmount) {
			this.withdrawAmount = withdrawAmount;
		}

	}

	class SCBWithdrawResult {
		private BigDecimal withdrawProfit;
		private String withdrawId;

		public void setWithdrawId(String withdrawId) {
			this.withdrawId = withdrawId;
		}

		public String getWithdrawId() {
			return withdrawId;
		}

		public void setWithdrawProfit(BigDecimal withdrawProfit) {
			this.withdrawProfit = withdrawProfit;
		}

		public BigDecimal getWithdrawProfit() {
			return withdrawProfit;
		}

	}

	SCBWithdrawResult doWithDrawApply(SCBWithdrawParam param);

	/**
	 * 查找出所有处理审核当中的提现申请
	 * 
	 * @param type
	 * @return
	 */
	List<Map> findChecking(String type);

	boolean doWithDraw(DoWithdrawParam doWithdrawParam);

	boolean doWithDraw(CPBDoWithdrawParam cpbWithDraw);

	List<WithdrawDO> find(String userId);

	/**
	 * 确认付款,并且自动打款到银行卡
	 * 
	 * @param doWithdrawParam
	 * @return
	 */
	boolean doConfirmWithdrawAndSubmitToFuiou(DoWithdrawParam doWithdrawParam);

	/**
	 * 定期,确认付款,并且自动打款到银行卡
	 * 
	 * @param param
	 * @return
	 */
	WithdrawDO doConfirmWithdrawAndSubmitToFuiou(CPBDoWithdrawParam param);
	/**
	 * 00:00:00 ~ 03:00:00 不可以提现
	 * @param time
	 * @return
	 */
	boolean isTimeWidthdrawApply(Date time);
	/**
	 * 完成该笔回款
	 * @param withdrawId
	 * @return
	 */ 
	boolean finish(String withdrawId, String certificateId);
	/**
	 * 计算取现时产生的利息
	 * @param withdrawId
	 * @return
	 */
	BigDecimal countProfit(String withdrawId);
	/**
	 * 计算最近一次复活提现利息。<h4 style="color:red">提现后，产生新利息前查询有效</h4>
	 * @param uid
	 * @return
	 */
	BigDecimal countLastCurrentWithdrawProfit(String uid);

	/**
	 * 查询赎回记录
	 * @param userId
	 * @param limit
	 * @param offset
	 * @return
	 */
	public List<WithdrawDO> findJzhRedemptionList(String userId, int limit, int offset);
}
